package com.neusoft.nepa.controller;

import com.neusoft.nepa.entity.Admin;
import com.neusoft.nepa.entity.AdminData;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.stage.Stage;

import java.io.IOException;

public class AQIConfigDetail {
    @FXML
    private Label index;
    @FXML
    private Label Location;
    @FXML
    private Label description;
    @FXML
    private Label degree;
    @FXML
    private Label date;
    @FXML
    private Label time;
    @FXML
    private Label name;

    @FXML
    private void logOut(ActionEvent event) throws IOException {
        Stage stage = (Stage) ((javafx.scene.Node) event.getSource()).getScene().getWindow();
        stage.close();
    }
    public void initialize()
    {
        Platform.runLater(() -> {
            refreshData();
        });
    }
    private void refreshData()
    {
        Stage stage = (Stage)index.getScene().getWindow();
        AdminData data = (AdminData) stage.getProperties().get("userInformation");
        index.setText(data.getPreviewIndex());
        description.setText(data.getInfo().replace("\n",""));
        degree.setText(data.getPreviewIndex());
        Location.setText(data.getWithinProvince()+data.getWithinCity());
        date.setText(data.getFeedbackDate());
        name.setText(data.getFeedbackName());
        time.setText(data.getFeedbackTime());
    }
}
//